﻿using UnityEngine;
using System.Collections;

public class Enemy : MonoBehaviour 
{
	
	public float m_Speed;
	public Transform m_Target;
	
	// Use this for initialization
	void Start () 
	{
		
	}
	
	// Update is called once per frame
	void Update () 
	{
		EnemyMoving();
	}
	
	void EnemyMoving()
	{
		float step = m_Speed*Time.deltaTime;
		float dist = 5;
		
		
		if(Vector3.Distance (transform.position, m_Target.position) > dist)
		{
			transform.position = Vector3.MoveTowards(transform.position, m_Target.position, step);
			
		}	
	}
}
